package redis

import "strconv"

// AddCart 添加购物车
func AddCart(userId, courseId int, cart map[string]interface{}) {

	key := "cart:user_id_" + strconv.Itoa(userId) + ":course_id_" + strconv.Itoa(courseId)

	Rdb.HMSet(key, cart)

}

func DelCart(userId, courseId int) error {
	key := "cart:user_id_" + strconv.Itoa(userId) + ":course_id_" + strconv.Itoa(courseId)

	result := Rdb.Keys(key).Val()
	Rdb.Del(result...)
	return nil
}
